---
name: Server installation
title: Server installation
route: /docs/deployment/installation/
menu: Deployment
meta:
  - name: description
    content: "Integrate Botfront with your environment"
  - name: keywords
    content: botfront webhooks
---

# Webhooks

To map Botfront features with the specificity of your infrastructure, you can implement webhooks that will be invoked by Botfront.

We provide an example implementation here: https://github.com/dialoguemd/botfront-webhooks-example

This example works well with the Terraform project we provide as an example in the installation section. 

## Restart Rasa

If set, this webhook will be invoked when a user edits `endpoints` or `credentials`, or performs any action requiring Rasa to restart.

#### Request

```js
{
    "projectId": string,
    "environment" : string,
}
```

#### Response

This route does not return a json. Botfront only expect the http status of the call to your restart rasa

## Upload Image

If set, an upload widget will be available in the dialog builder. The webhook will be invoked when a user uploads an image.

#### Request

```js
{
    "projectId": string,
    "data": string, // image encoded in base64
    "mimeType": string,
    "language": string,
    "responseId": string // template name followed by unix timestamp, e.g. utter_get_started_1588107073256
}
```

#### Response

```js
{
    "uri": string // the publicly accessible URI for the asset just received
}
```

## Delete Image

The webhook will be invoked by Botfront when an image URL is no longer used in a response. The request will be sent whether or not the resource actually exists on the server.

#### Request

```js
{
    "projectId": string,
    "uri": string // the publicly accessible URI for the asset to be deleted
}
```

#### Response

Botfront expects a 204 success response, and a 404 if ressource was not found. Any other response may signal an error to the user in the future.


## Deploy

If set, and your project has environements, the deploy menu will be available next to the training button.

#### Request

Botfront will send a request to the api with the following information

```js
{
    "projectId" : string, 
    "namespace" : string, 
    "environment" : string,
    "gitString" : string, 
}
```

#### Response
 
Botfront expects a successful response to have the status code 200, responses with other status codes are treated as errors. 
You can specify a `message` property which will be displayed in a notification if the status code is 200.

```js
{
    "message" : string
}
```

If the status code is not 200 botfront will display the `detail` property in a notification.

```js
{
    "detail" : string
}
```

### PostTraining

If set, This webhook will be invoked every time a project finishes training.

### Request

Botfront will send a request to the webhook url with the following parameters.

```js
{
    "projectId" : string,
    "namespace" : string,
    "model" : string, // base64 conversion of the trained model
    "mimeType" string,
}
```

#### Expected response

Botfront except a 200 success response, other response are treated as errors.
You can add a message property in the error response body that will be displayed to the user.

## Report Crash

If set, browser crashes caused by Botfront will be reported to the webhook automatically.

#### Request

Botfront will forward the following to the webhook:

```js
{
    "version": string,
    "path": string,
    "error": string,
    "trace": string
}
```

#### Response
 
Success-like responses (e.g. 200) are treated as successful.
